package com.ruoyi.CompareCoordinate.controller;

import com.ruoyi.CompareCoordinate.service.impl.CompareCoordinate;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.CompareCoordinate.domain.CoordinateCompare;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/coordinate")
public class CompareCoordinateController extends BaseController
{

    /**
     * 唯一入口：文件夹 vs 文件夹
     */
    @PostMapping("/compare")
    public R<Map<String, Map<String, CoordinateCompare>>> compare(
            @RequestPart("theoryFiles") List<MultipartFile> theoryFiles,
            @RequestPart("actualFiles") List<MultipartFile> actualFiles,
            @RequestParam double tolerance,
            @RequestParam int paramCount) throws Exception {

        return R.ok(CompareCoordinate.compareFolders(theoryFiles, actualFiles, tolerance, paramCount),"对比完成！");
    }
}